<?php
$q=$_GET["q"];
$array= explode(",",$q);
$exa=$array[2];
$School_Id=$array[1];
$Year=$array[0];
$hint="";
include_once '../Login/databaseconnection.php';
if($exa!="Select One"&&$School_Id!=""&&$Year!="Select One"&&$Year!="")
{
$exam=mysql_query("SELECT * FROM exam WHERE Exam_Name='$exa' AND Year='$Year' AND School_Id='$School_Id'");
if($exam)
{
if($row_exam=mysql_fetch_array($exam))
{
$Sat_Students=$row_exam['No_Of_Sat_Students'];
$Passed_Students=$row_exam['No_Of_Passed_Students'];
$Percentage=($Passed_Students/$Sat_Students)*100;
if($Percentage!="")
{
$Percentage=$Percentage."%";
}
}
else
{
$Sat_Students="0";
$Passed_Students="0";
$Percentage="0%";
}
}
 $hint=$hint.'<table height="100" class="imgholder">
             <tr>
        <th>        
         <label>Total number sat students:</label>
         </th>
         <td>';
         $hint=$hint."<input type='text' name='Sat_Students' value='$Sat_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
$hint=$hint.'</td>
         </tr>
         <tr>
        <th>        
         <label>Total number of passed students:</label>
         </th>
         <td>';
         $hint=$hint."<input type='text' name='Passed_Students' value='$Passed_Students' readonly='readonly' onmouseover='clearpopbox()'/>";
$hint=$hint.'</td>
         </tr>
          <tr>
        <th>        
         <label>Percentage:</label>
         </th>
         <td>';
         $hint=$hint."<input type='text' name='Percentage' value='$Percentage' readonly='readonly' onmouseover='clearpopbox()'/>";
$hint=$hint.'</td>
         </tr>
         </table>';
}
if($hint=="")
{
if($School_Id=="")
{
$response="<font color='red'>*Please select a school!</font>";
}
$response=$response.'<table height="100" class="imgholder">
             <tr>
        <th>        
         <label>Total number sat students:</label>
         </th>
         <td>';
         $response=$response."<input type='text' name='Sat_Students' readonly='readonly'/>";
$response=$response.'</td>
         </tr>
         <tr>
        <th>        
         <label>Total number of passed students:</label>
         </th>
         <td>';
         $response=$response."<input type='text' name='Passed_Students' readonly='readonly'/>";
$response=$response.'</td>
         </tr>
          <tr>
        <th>        
         <label>Percentage:</label>
         </th>
         <td>';
$response=$response."<input type='text' name='Percentage' readonly='readonly'/>";
$response=$response.'</td>
         </tr>
         </table>';
}
else
{
$response=$hint;
}
echo $response;
?>